package de.baumann.browser.present

import de.baumann.browser.api.OdinObserver
import de.baumann.browser.api.net.vo.RechargeInfo
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.IRechargeView
import de.baumann.browser.model.OrderModel

class RechargePresenter : BasePresenter<IRechargeView>() {

    fun getRechargeAddress() {
        OrderModel().rechargeAddress
                .subscribe(object : OdinObserver<RechargeInfo>(view) {
                    override fun onSuccess(data: RechargeInfo?) {
                        if (view != null && data!=null){
                            view.setRechargeAddress(data.odinErc20Address)
                            view.setRechargeQrcode(data.odinErc20Qcode)
                        }
                    }
                })
    }

}